package tech.aiflowy.ai.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tech.aiflowy.ai.entity.AiLlm;
import tech.aiflowy.ai.enums.TaskType;
import tech.aiflowy.ai.service.AiLlmService;
import tech.aiflowy.ai.utils.TaskTypeClassifierUtil;
import tech.aiflowy.common.domain.Result;

import javax.annotation.Resource;

/**
 * @author br
 */
@RestController
@RequestMapping("/ai/chat")
public class AiAchatController {
    @Resource
    private AiLlmService aiLlmService;

    @RequestMapping("/classifier")
    public Result getType(@RequestParam("message") String message){
        //可以自己定义id
        AiLlm aiLlm = aiLlmService.getMapper().selectOneById(273418062806761472L);
        TaskTypeClassifierUtil taskTypeClassifierUtil = new TaskTypeClassifierUtil(aiLlm);
        TaskType task = taskTypeClassifierUtil.format(message);
        return Result.success(task.name());
    }

}
